import 'package:flutter/material.dart';
import 'package:ball_lion/routes/routes.dart';
import 'package:ball_lion/widgets/share/share_sheet.dart';
import 'package:ball_lion/resources/colours.dart';
import 'package:ball_lion/utils/utils.dart';

class ShareButton extends StatelessWidget {
  const ShareButton({
    super.key,
    this.color = Colours.white,
    required this.route,
    this.title = '分享给你一个看比赛和数据的APP',
    this.content = '球狮体育，专业体育比分预测平台',
    this.logoUrl,
    this.onTap,
    this.imageWidget,
    this.needChannel = false,
    this.icon = "icon_share.png",
  });

  final String icon;
  final Color color;
  final String route;
  final String title;
  final String content;
  final String? logoUrl;
  final bool needChannel;
  final Function<Widget>()? imageWidget;
  final Function()? onTap;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        onTap: () => Routes.toPage(Routes.share,
            arguments: ShareEntity(
                title: title,
                content: content,
                url: route,
                logo: logoUrl,
                needChannel: needChannel,
                imageWidget: imageWidget?.call(),
                onTap: onTap)),
        child: SizedBox(
            width: 24,
            height: 40,
            child: Image.asset(Utils.getImgPath("icon_share.png"),
                color: color, width: 24)));
  }
}
